import {expect, test} from 'bun:test';
import {exampleAudioSamplePositions} from '../create/iso-base-media/example-stts';
import {createStsz} from '../create/iso-base-media/trak/mdia/minf/stbl/create-stsz';

const refernce = new Uint8Array([
	0, 0, 3, 12, 115, 116, 115, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 190, 0, 0,
	3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0,
	3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0,
	3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0,
	3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0,
	3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0,
	3, 78, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0,
	3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0,
	3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0,
	3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0,
	3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0,
	3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0,
	3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3,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, 0, 0, 3, 79, 0, 0,
	3, 78, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0,
	3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0,
	3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0,
	3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0,
	3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0,
	3, 79, 0, 0, 3, 78, 0, 0, 3, 78, 0, 0, 3, 79,
]);

test('stsz', () => {
	expect(createStsz(exampleAudioSamplePositions)).toEqual(refernce);
});
